package com.itheima.controller;

import com.itheima.entity.Article;
import com.itheima.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class ArticleController {

    @Autowired
    ArticleService articleService;

    @GetMapping("/article")
    public String article(Model model){
        List<Article> articleList = articleService.findAll();
        model.addAttribute("articles", articleList);
        return "article";
    }
}